package com.alameda.service.statement;

import com.alameda.api.statement.StatementService;
import com.alameda.mapper.statement.StatementMapper;
import com.alameda.statement.dto.StatementDTO;
import com.alameda.statement.pojo.StatementDO;
import com.alameda.statement.vo.StatementVO;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 数据报表 业务逻辑层 具体实现
 *
 * @author Lv
 * @date 2024/07/11
 */
@Slf4j
@Service
public class StatementServiceImpl extends ServiceImpl<StatementMapper, StatementDO> implements StatementService {

    @Autowired
    private StatementMapper statementMapper;

    /**
     * 读取报表数据
     *
     * @param statementDTO 数据报表数据传递对象
     * @return
     */
    @Override
    public List<StatementVO> findCount(StatementDTO statementDTO) {
        StatementDO statementDO = this.findOne(StatementDO.builder().statementKey(statementDTO.getStatementKey()).build());
        return statementMapper.findStatement(statementDO.getStatementSql());
    }
}
